package com.imooc.cart.service;

import com.imooc.pojo.ShopcartBo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 购物车
 * @author 顾志杰
 * @date 2020/9/7-15:33
 */
@RequestMapping("cart-api")
public interface CartService {
    /**
     * 添加购物车
     * @param userId
     * @param shopcartBO
     * @return
     */
    @PostMapping("addItem")
    public boolean addItemToCart(@RequestParam("userId") String userId,
                                 @RequestBody ShopcartBo shopcartBO);

    /**
     * 删除购物车商品
     * @param userId
     * @param itemSpecId
     * @return
     */
    @PostMapping("removeItem")
    public boolean removeItemFromCart(@RequestParam("userId") String userId,
                                      @RequestParam("itemSpecId") String itemSpecId);

    /**
     * 清空购物车
     * @param userId
     * @return
     */
    @PostMapping("clearCart")
    public boolean clearCart(@RequestParam("userId") String userId);
}
